package com.yuandian.management.controller;

import com.yuandian.api.business_monitor.po.SearchParams;
import com.yuandian.api.management.entity.ConfMenuMapping;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.management.service.ConfMenuMappingService;
import com.yuandian.utils.ListUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * 菜单映射关系表-Controller
 * @author zfsn
 * @date 2023-4-18
 */
@Api(tags = "菜单映射关系表功能接口")
@RestController
@RequestMapping("/menuMapping")
public class ConfMenuMappingController {

	@Autowired
	private ConfMenuMappingService service;

	/**
	 * 远程调用接口
	 * 查询菜单并装换成 Map<菜单ID, 菜单名称>
	 *
	 * @param params
	 * @return 搜索选项vo对象集合
	 */
	@ApiIgnore
	@PostMapping("/getMenuMap")
	public Map<String, String> getMenuMap(@RequestBody SearchParams params) {
		return service.getMenuMap(params);
	}

	@ApiOperation(value = "查询菜单映射关系全部数据", notes = "查询菜单映射关系全部数据")
	@GetMapping("/all")
	public R<List<ConfMenuMapping>> getAllConfMenuMapping() {
		return R.ok(service.list());
	}
}
